//
//  GlobalData.m
//  Memory Mania
//
//  Created by Sanket Karkhanis on 2/21/12.
//  Copyright 2012 University of Southern California. All rights reserved.
//

#import "GlobalData.h"

@implementation GlobalData
@synthesize rows = _rows;
@synthesize cols = _cols;
@synthesize highscore = _highscore;
@synthesize score1 = _score1;
@synthesize score2 = _score2;

static GlobalData *_sharedGlobalData = nil;

+(GlobalData *) sharedGlobalData{
    @synchronized([GlobalData class])
    {
        if (!_sharedGlobalData)
            [[self alloc] init];
        
        return _sharedGlobalData;
    }
    
    return nil;
}
+(id)alloc
{
    @synchronized([GlobalData class])
    {
        NSAssert(_sharedGlobalData == nil, @"Attempted to allocate a second instance of a singleton.");
        _sharedGlobalData = [super alloc];
        return _sharedGlobalData;
    }
    
    return nil;
}
- (id)init
{
    self = [super init];
    if (self) {
        // Initialization code here.
    }
    
    return self;
}

@end
